Java 9.0 to 17.0 Cookbook: A Roadmap with Instructions for the Effective Implementation of Features, Codes, and Programs by Tejaswini Jog & Mandar Jog

Java 9.0 to 17.0 Cookbook: A Roadmap with Instructions for the Effective Implementation of Features, Codes, and Programs by Tejaswini Jog & Mandar Jog

Author:Tejaswini Jog & Mandar Jog [Jog, Tejaswini & Jog, Mandar]
Language: eng
Format: epub
Publisher: BPB Publications
Published: 2023-04-15T00:00:00+00:00


public class ExceptionallyAsyncWithExecutor {

public void doSomeTask(int value) {

System.out.println("Working with exceptionallyAsync with Executor==>");

ExecutorService executor = Executors.newFixedThreadPool(10);

int data=١٠٠;

CompletableFuture.supplyAsync(() -> {

System.out.println("supplyAsync() executed by:" + Thread.currentThread().getName());

int ans = data / value;

return ans;

}).thenAcceptAsync(s -> {

System.out.println("acceptAsync() executed by:" + Thread.currentThread().getName());



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.